package com.g8.pethospitallearnbackend.mapper;

import com.g8.pethospitallearnbackend.entity.ExamStuQues;
import com.g8.pethospitallearnbackend.entity.ExamStuQuesExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface ExamStuQuesMapper {
    @SelectProvider(type=ExamStuQuesSqlProvider.class, method="countByExample")
    long countByExample(ExamStuQuesExample example);

    @DeleteProvider(type=ExamStuQuesSqlProvider.class, method="deleteByExample")
    int deleteByExample(ExamStuQuesExample example);

    @Insert({
        "insert into exam_stu_ques (exam_id, user_id, ",
        "ques_id, is_correct, ",
        "attempt)",
        "values (#{examId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, ",
        "#{quesId,jdbcType=VARCHAR}, #{isCorrect,jdbcType=TINYINT}, ",
        "#{attempt,jdbcType=VARCHAR})"
    })
    int insert(ExamStuQues record);

    @InsertProvider(type=ExamStuQuesSqlProvider.class, method="insertSelective")
    int insertSelective(ExamStuQues record);

    @SelectProvider(type=ExamStuQuesSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="exam_id", property="examId", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="ques_id", property="quesId", jdbcType=JdbcType.VARCHAR),
        @Result(column="is_correct", property="isCorrect", jdbcType=JdbcType.TINYINT),
        @Result(column="attempt", property="attempt", jdbcType=JdbcType.VARCHAR)
    })
    List<ExamStuQues> selectByExample(ExamStuQuesExample example);

    @UpdateProvider(type=ExamStuQuesSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ExamStuQues record, @Param("example") ExamStuQuesExample example);

    @UpdateProvider(type=ExamStuQuesSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ExamStuQues record, @Param("example") ExamStuQuesExample example);
}